import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.Closeable; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashSet; import java.util.TreeMap; public class Main { static ContestScanner in;static Writer out;public static void main(String[]args) {try{in=new ContestScanner();out=new Writer();Main solve=new Main();solve.solve(in,out); in.close();out.close();}catch(IOException e){e.printStackTrace();}} void dump(int[]a){for(int i=0;i0){if((n&1)==1)r*=a;a*=a;n>>=1;}return r;} String itob(int a,int l){return String.format("%"+l+"s",Integer.toBinaryString(a)).replace(' ','0');} void sort(int[]a){m_sort(a,0,a.length,new int[a.length]);} void m_sort(int[]a,int s,int sz,int[]b) {if(sz<7){for(int i=s;is&&a[j-1]>a[j];j--)swap(a,j,j-1);return;} m_sort(a,s,sz/2,b);m_sort(a,s+sz/2,sz-sz/2,b);int idx=s;int l=s,r=s+sz/2;final int le=s+sz/2,re=s+sz; while(la[r])b[idx++]=a[r++];else b[idx++]=a[l++];} while(rv)r=m-1;else{l=m+1;s=m;}}return a[s]>v?-1:s;} void solve(ContestScanner in,Writer out)throws NumberFormatException,IOException{ int n = in.nextInt(); int m = in.nextInt(); MultiSet hash_multiset = new MultiSet<>(); for(int i=0; i extends HashMap{ @Override public Integer get(Object key){return containsKey(key)?super.get(key):0;} public void add(T key,int v){put(key,get(key)+v);} public void add(T key){put(key,get(key)+1);} public void sub(T key) {final int v=get(key);if(v==1)remove(key);else put(key,v-1);} } class OrderedMultiSet extends TreeMap{ @Override public Integer get(Object key){return containsKey(key)?super.get(key):0;} public void add(T key,int v){put(key,get(key)+v);} public void add(T key){put(key,get(key)+1);} public void sub(T key) {final int v=get(key);if(v==1)remove(key);else put(key,v-1);} } class Pair implements Comparable{ int a,b;int hash;Pair(int a,int b){this.a=a;this.b=b;hash=(a<<16|a>>16)^b;} public boolean equals(Object obj){Pair o=(Pair)(obj);return a==o.a&&b==o.b;} public int hashCode(){return hash;} public int compareTo(Pair o){if(a!=o.a)return a