#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  ~debug() { cerr << endl; }
  template <class c>
  typename enable_if<sizeof dud<c>(0) != 1, debug&>::type operator<<(c i) {
    cerr << boolalpha << i;
    return *this;
  }
  template <class c>
  typename enable_if<sizeof dud<c>(0) == 1, debug&>::type operator<<(c i) {
    return *this << range(begin(i), end(i));
  }
  template <class c, class b>
  debug& operator<<(pair<b, c> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }
  template <class c>
  debug& operator<<(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};
long double eps = (long double)1 / 1e6;
const long double pi = 3.14159265359;
long long inf = 1e18, mod1 = 1e9 + 7;
long long sqr(long long a) { return a * a; }
long long qb(long long a) { return a * a * a; }
void umin(int& a, int b) { a = min(a, b); }
bool is_prime(long long val) {
  for (long long i = 2; i <= sqrt(val); i++)
    if (val % i == 0) return 0;
  return 1;
}
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long binpow(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod
                    : sqr(binpow(a, b / 2, mod)) % mod)
           : 1;
}
long long binmult(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod
                    : (2 * binmult(a, b / 2, mod)) % mod)
           : 0;
}
const long long tx[4] = {0, 1, -1, 1};
const long long ty[4] = {-1, 0, 1, 1};
const char rev_to[4] = {'E', 'W', 'N', 'S'};
int M = 200 + 1;
const int N = 1e5 + 2;
const int pp = 73;
const int lg = 19;
const int OPEN = 1;
const int CLOSE = 0;
auto rnd = bind(uniform_int_distribution<long long>(1, N), mt19937(time(0)));
void bad() {
  cout << "NE";
  exit(0);
}
pair<int, int> a[N];
const int K = 2 * 64 * 200;
vector<vector<int>> dp(M + 1, vector<int>(K + 1, -1e9));
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    long long val;
    cin >> val;
    while (val % 2 == 0) a[i].first++, val /= 2;
    while (val % 5 == 0) a[i].second++, val /= 5;
  }
  int ans = 0;
  int lol = K / 2;
  dp[0][lol] = 0;
  for (int i = 0; i < n; i++) {
    int ps = a[i].first - a[i].second;
    for (int j = k - 1; j >= 0; j--) {
      for (int bal = -lol; bal <= lol; bal++) {
        if (bal + ps < -lol || bal + ps > lol) continue;
        if (dp[j][bal + lol] < 0) continue;
        int first = a[i].first, second = a[i].second;
        if (bal < 0)
          second += abs(bal);
        else
          first += abs(bal);
        dp[j + 1][bal + lol + ps] = max(dp[j + 1][bal + lol + ps],
                                        dp[j][bal + lol] + min(first, second));
      }
    }
  }
  for (int i = -lol; i <= lol; i++) ans = max(ans, dp[k][i + lol]);
  cout << ans;
  return 0;
}
