#include <bits/stdc++.h>
using namespace std;
const long long maxn = 105;
const long long mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k, i, j, x;
  cin >> n >> k;
  int res = 0;
  priority_queue<pair<int, int>, vector<pair<int, int>>> pq;
  for (i = 0; i < n; i++) {
    cin >> x;
    res += x / 10;
    pq.push({x % 10, x});
  }
  while (!pq.empty()) {
    pair<int, int> v = pq.top();
    pq.pop();
    if (v.second == 100) continue;
    if (v.first > 0) {
      if (k >= (10 - v.first)) {
        k -= (10 - v.first);
        ++res;
        pq.push({0, v.second + 10 - v.first});
      } else
        break;
    } else {
      if (k >= 10) {
        k -= 10;
        ++res;
        pq.push({0, v.second + 10 - v.first});
      } else
        break;
    }
  }
  cout << res;
}
