I,R=input,range N,K=map(int,I().split()) M=set() P=pow(5,K-1) for i in R(N): S=int(I(),5) b=0 for m in M: s,t,p=S,m,P for j in R(K): b+=t