#include <bits/stdc++.h>
using namespace std;
const int maxN = 111;
int a[maxN + 1][maxN + 1], b[maxN];
int main() {
  int m, n;
  cin >> m >> n;
  for (int i = 1; i <= n; ++i) {
    string s;
    cin >> s;
    for (int j = 1; j <= m; ++j) a[i][j] = s[j - 1] - '0';
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j)
      if (a[i][j] == 0) b[i] = 1;
  }
  int ans = 0, cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (b[i] == 1)
      ++cnt;
    else
      cnt = 0;
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}
