#include <bits/stdc++.h>
using namespace std;
struct data {
  int val;
  int rest;
  bool used;
  data() {}
  data(int val, int rest, bool used) : val(val), rest(rest), used(used) {}
  bool operator<(data x) const {
    if (x.used) return 0;
    if (used) return 1;
    return rest < x.rest;
  }
};
int main() {
  int N, K, nxt;
  cin >> N >> K;
  priority_queue<data> PQ;
  for (int i = (0); i < (N); i++) {
    cin >> nxt;
    PQ.push(data(nxt, nxt % 10, nxt == 100));
  }
  while (K and PQ.top().used == 0) {
    data v = PQ.top();
    PQ.pop();
    int need = 10 - v.rest;
    need = min(need, K);
    v.val += need;
    v.rest = v.val % 10;
    v.used = (v.val == 100);
    PQ.push(v);
    K -= need;
  }
  int ans = 0;
  while (!PQ.empty()) {
    ans += PQ.top().val / 10;
    PQ.pop();
  }
  cout << ans << endl;
}
