#include <bits/stdc++.h>
int main() {
  char a[105];
  int n, m, flag = 0, maxx = 0, s = 0;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%s", a);
    int t = strlen(a);
    for (int j = 0; j < t; j++) {
      if (a[j] == '0') {
        flag = 1;
        break;
      }
    }
    if (flag == 1) {
      s++;
      flag = 0;
    } else {
      if (maxx < s) {
        maxx = s;
      }
      s = 0;
    }
  }
  if (maxx < s) {
    maxx = s;
    s = 0;
  }
  printf("%d\n", maxx);
}
