class Solution { public int lastRemaining(int n, int m) { if(n==0||m==0) { return -1; } List list = new ArrayList<>(); for(int i=0;i