#include <bits/stdc++.h>
using namespace std;
int read() {
  int ret = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  for (; ch >= '0' && ch <= '9'; ch = getchar()) ret = ret * 10 + ch - '0';
  return ret;
}
long long readf() {
  long long t = 0, flag = 1;
  char c = getchar();
  while (c < '0' || c > '9' || c == '-') {
    if (c == '-') flag = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    t = t * 10 + c - '0';
    c = getchar();
  }
  return t * flag;
}
int main() {
  int n = read(), d = read();
  int ans = 0, res = 0;
  int flag;
  string s;
  for (int i = 1; i <= d; i++) {
    cin >> s;
    flag = 0;
    for (int j = 0; j < s.size(); j++)
      if (s[j] == '0') {
        flag = 1;
        break;
      }
    if (!flag) res = 0;
    if (flag) res += 1;
    ans = max(ans, res);
  }
  cout << ans << endl;
}
