#include <bits/stdc++.h>
const int MAXN = (int)1e6 + 5;
const int MODN = (int)1e9 + 7;
int inf = 0x3f3f3f3f;
using namespace std;
int a[105];
char str[105][105];
int main() {
  int n, m;
  while (scanf("%d%d", &m, &n) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf("%s", str[i]);
    }
    memset(a, 0, sizeof(a));
    for (int i = 0; i < n; i++) {
      int flag = 0;
      for (int j = 0; j < m; j++) {
        if (str[i][j] == '0') {
          flag = 1;
        }
      }
      if (flag == 1) {
        a[i] = 1;
      }
    }
    int sum = 0, maxx = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == 1) {
        sum++;
      } else {
        if (sum > maxx) {
          maxx = sum;
        }
        sum = 0;
      }
    }
    if (sum > maxx) {
      maxx = sum;
    }
    printf("%d\n", maxx);
  }
}
