#include <bits/stdc++.h>
using namespace std;
char s[105];
int main() {
  int n, d;
  while (~scanf("%d %d", &n, &d)) {
    int cc = 0;
    int ans = 0;
    for (int i = 0; i < d; ++i) {
      scanf("%s", s);
      int tmp = 0;
      for (int i = 0; i < n; ++i) {
        if (s[i] == '1') tmp++;
      }
      if (tmp < n) {
        cc++;
        ans = max(ans, cc);
      } else
        cc = 0;
    }
    printf("%d\n", ans);
  }
  return 0;
}
