#include <bits/stdc++.h>
using namespace std;
int max2[205][6005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  fill_n(max2[0], 205 * 6005, -1);
  max2[0][0] = 0;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    int p2 = 0, p5 = 0;
    while (a % 2 == 0) {
      a /= 2;
      p2++;
    }
    while (a % 5 == 0) {
      a /= 5;
      p5++;
    }
    for (int pos = k - 1; pos >= 0; pos--) {
      for (int s = p5; s < 6005; s++) {
        if (max2[pos][s - p5] != -1) {
          max2[pos + 1][s] = max(max2[pos + 1][s], max2[pos][s - p5] + p2);
        }
      }
    }
  }
  int best = 0;
  for (int i = 0; i < 6005; i++) {
    best = max(best, min(i, max2[k][i]));
  }
  cout << best << '\n';
  return 0;
}
