#include <bits/stdc++.h>
using namespace std;
int n, m, c, mx = 0;
bool used;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> s;
    used = false;
    for (int j = 0; j < n; j++)
      if (s[j] == '0') {
        c++, used = true;
        break;
      }
    if (!used) mx = max(mx, c), c = 0;
  }
  if (used) mx = max(mx, c), c = 0;
  cout << mx;
}
