#include <bits/stdc++.h>
using namespace std;
int const N = 200001;
int n, k, v[N], f[101];
int main() {
  scanf("%d%d", &n, &k);
  int an = 0;
  set<pair<int, int>> x;
  for (int i = 0; i < n; ++i) {
    scanf("%d", v + i);
    ++f[v[i] % 10];
    x.insert({v[i] % 10, v[i] % 10});
    an += (v[i] / 10);
  }
  while (k && !x.empty()) {
    pair<int, int> q = *x.rbegin();
    x.erase(q);
    int need = 10 - q.first;
    int can = min(k / need, f[q.second]);
    int nm = q.second + need;
    k -= (can * need);
    if (!can) break;
    f[q.second] -= can;
    if (!f[nm % 10] && nm < 100) x.insert({nm % 10, nm % 10});
    f[nm % 10] += can;
    an += ((nm / 10) * can);
  }
  printf("%d\n", min(n * 10, an));
}
