#include <bits/stdc++.h>
using namespace std;
const int Xp5 = 5229, Xn = 256;
int dp[Xn][Xp5];
int main() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > V(n);
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    while (!(x % 2)) {
      x /= 2;
      V[i].first++;
    }
    while (!(x % 5)) {
      x /= 5;
      V[i].second++;
    }
  }
  for (int i = 0; i <= k; i++)
    for (int j = 0; j < Xp5; j++) dp[i][j] = -12345;
  dp[0][0] = 0;
  for (int i = 0; i < n; i++)
    for (int c = k; c; c--)
      for (int p5 = V[i].second; p5 < Xp5; p5++)
        dp[c][p5] = max(dp[c][p5], dp[c - 1][p5 - V[i].second] + V[i].first);
  int a = 0;
  for (int p5 = 0; p5 < Xp5; p5++)
    a = max(a, dp[k][p5] ? min(dp[k][p5], p5) : 0);
  cout << a << "\n";
}
