#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    pq;
int main() {
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int aux;
    cin >> aux;
    if (aux == 100) {
      ans += 10;
    } else {
      pq.push(make_pair(10 - (aux % 10), aux));
    }
  }
  while (k and !pq.empty()) {
    pair<int, int> cur = pq.top();
    pq.pop();
    int to = min(k, cur.first);
    cur.second += to;
    k -= to;
    cur.first = 10;
    if (cur.second == 100) {
      ans += 10;
    } else {
      pq.push(cur);
    }
  }
  while (!pq.empty()) {
    pair<int, int> cur = pq.top();
    pq.pop();
    ans += cur.second / 10;
  }
  cout << ans << "\n";
  return 0;
}
