#include <bits/stdc++.h>
int main() {
  int n, d, i, j;
  scanf("%d %d", &n, &d);
  int count = 0, ans = 0;
  for (j = 1; j <= d; j++) {
    char a[n + 1];
    int count0 = 0, count1 = 0;
    for (i = 0; i <= n; i++) {
      scanf("%c", &a[i]);
      if (a[i] == '1')
        count1++;
      else if (a[i] == '0')
        count0++;
    }
    if (count1 != n)
      count++;
    else if (count1 == n) {
      count = 0;
    }
    ans = (ans > count ? ans : count);
  }
  printf("%d", ans);
  return 0;
}
