#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 100;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, d, mx = 0, x = 0, l = 0;
  cin >> n >> d;
  string s[d];
  for (long long int i = 0; i < d; i++) {
    cin >> s[i];
    for (long long int j = 0; j < s[i].size(); j++) {
      if (s[i][j] == '0') {
        x++;
        goto hell;
      }
    }
    mx = max(mx, x);
    x = 0;
  hell:;
  }
  mx = max(x, mx);
  cout << mx << endl;
}
