#include <bits/stdc++.h>
int main() {
  int n, d, count = 0, i, j, temp = 0, o = 0;
  scanf("%d %d", &n, &d);
  char arr[n];
  for (i = 0; i < d; i++) {
    scanf("%s", arr);
    count = 0;
    for (j = 0; j < n; j++) {
      if (arr[j] == '0') {
        count++;
        break;
      }
    }
    if (count == 1) {
      temp++;
      if (temp > o) o = temp;
    } else
      temp = 0;
  }
  printf("%d\n", o);
  return 0;
}
