#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
using namespace std;
const int N = 1e5 + 2;
int a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = int(0); i < int(n); ++i) {
    int x;
    cin >> x;
    a[i] = x;
  }
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  for (int i = int(0); i < int(n); ++i) {
    int x = 10 - a[i] % 10;
    if (x == 0) x = 10;
    pq.push(pair<int, int>(x, i));
  }
  while (!pq.empty()) {
    pair<int, int> fr = pq.top();
    pq.pop();
    int x = fr.first, pos = fr.second;
    if (a[pos] == 100) continue;
    if (x > k) break;
    a[pos] += x;
    k -= x;
    if (a[pos] != 100) {
      pq.push(pair<int, int>(10, pos));
    }
  }
  int cur = 0;
  for (int i = int(0); i < int(n); ++i) cur += a[i] / 10;
  cout << cur << endl;
  return 0;
}
