#include <bits/stdc++.h>
using namespace std;
char str[105];
int main() {
  int n, d;
  scanf("%d%d", &n, &d);
  int tmp = 0, ans = 0;
  for (int it = 0; it < d; it++) {
    scanf("%s", str);
    bool ok = 0;
    for (int i = 0; i < n; i++) {
      if (str[i] == '0') ok = 1;
    }
    if (ok)
      tmp++;
    else
      tmp = 0;
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}
