#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[100100];
int main() {
  int n, m, res = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].second;
    a[i].first = a[i].second % 10;
  }
  sort(a + 1, a + n + 1, greater<pair<int, int> >());
  for (int i = 1; i <= n; i++)
    if (a[i].first != 0) {
      int k = min(10 - a[i].first, m);
      m -= k;
      a[i].second += k;
    }
  for (int i = 1; i <= n; i++) {
    int k = min(m, 100 - a[i].second);
    m -= k;
    res += (a[i].second + k) / 10;
  }
  cout << res;
}
