import pandas as pd
import numpy as np
a,b = input("").split(" ")[:2]
a = int(a)
b = int(b)
c = input("").split(" ")
can = 0
for i in range(b):
c[i] = list(c[i])
df = pd.DataFrame(c)
df = df.transpose()
df = df.drop_duplicates()
df = df.astype(int)
#df["sum"] = sum(df)
df = df.transpose()
for i in df:
if(sum(df[i]) == 1):
can+=1
print(can)