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