#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      que;
  for (int i = 0; i < n; i++) {
    int d = v[i] % 10;
    que.push(pair<int, int>(10 - d, v[i]));
  }
  int ans = 0;
  while (k > 0 && que.size()) {
    pair<int, int> p = que.top();
    que.pop();
    if (p.second == 100) {
      ans += 10;
      continue;
    }
    if (k >= p.first) {
      que.push(pair<int, int>(10, p.second + p.first));
      k -= p.first;
    } else {
      p.first -= k;
      que.push(pair<int, int>(p.first, p.second + k));
      k = 0;
    }
  }
  while (que.size()) {
    pair<int, int> p = que.top();
    que.pop();
    ans += p.second / 10;
  }
  cout << ans << endl;
  return 0;
}
