#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie();
  cout.tie();
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  long long a[n];
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<long long> g;
  long long ans = 0;
  for (long long j = 0; j < n; ++j) {
    g.push_back(10 - (a[j] - a[j] / 10 * 10));
    ans += a[j] / 10;
  }
  sort(g.begin(), g.end());
  for (long long l = 0; l < g.size(); ++l) {
    k -= g[l];
    if (k < 0) {
      k += g[l];
      break;
    }
    ans++;
  }
  ans += k / 10;
  cout << min(ans, n * 10);
}
