#include <bits/stdc++.h>
int main() {
  int n, day, max = 0, count = 0, flag;
  char enemy[101];
  scanf("%d %d", &n, &day);
  for (int q = 1; q <= day; q++) {
    flag = 1;
    scanf("%s", enemy);
    for (int w = 0; w < n; w++) {
      if (enemy[w] == '0') {
        flag = 0;
        break;
      }
    }
    if (flag == 0) {
      count++;
    } else if (flag == 1) {
      if (count > max) {
        max = count;
      }
      count = 0;
    }
  }
  if (count > max) {
    max = count;
  }
  printf("%d\n", max);
}
