#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, i, p = 0, m = 0;
  cin >> n >> d;
  char a[111], l[111];
  for (i = 0; i < n; i++) {
    l[i] = '1';
  }
  l[n] = '\0';
  while (d--) {
    cin >> a;
    a[n] = '\0';
    if (!!strcmp(a, l)) {
      p++;
    } else {
      if (m < p) m = p;
      p = 0;
    }
  }
  if (m < p) m = p;
  cout << m;
  return 0;
}
