#include <bits/stdc++.h>
using namespace std;
int i, n, k, x, ans, c;
pair<int, int> a[100005];
int main() {
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> x;
    a[i].first = 10 - x % 10;
    a[i].second = x;
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    if (a[i].second < 100 && (k - (10 - a[i].second % 10) >= 0)) {
      a[i].second += 10 - a[i].second % 10;
      k -= a[i].first;
    } else {
      break;
    }
    if (i == n - 1) {
      break;
    }
  }
  for (i = 0; i < n; i++) {
    ans += a[i].second / 10;
  }
  cout << min(n * 10, ans + k / 10);
}
