#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, i, j = 0;
  char ch[200];
  cin >> x >> y;
  int a[y + 1];
  memset(a, 0, sizeof(a));
  int b = -1;
  for (i = 0; i < y; i++) {
    scanf("%s", &ch);
    int s = 0;
    int i_1 = 0, i_0 = 0;
    for (int k = 0; k < strlen(ch); k++) {
      if (ch[k] == '0') i_0++;
    }
    if (i_0 != 0) {
      if (b == 1) {
        a[j]++;
        b = 1;
      } else {
        b = 1;
        j++;
        a[j]++;
      }
    } else
      b = -1;
  }
  sort(a, a + (y + 1));
  cout << a[y] << endl;
  return 0;
}
