#include <bits/stdc++.h>
using namespace std;
bool func(long long a, long long b) { return a % 10 > b % 10; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n, func);
  long long sum = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] % 10 != 0) {
      if (k >= 10 - arr[i] % 10) {
        k = k - (10 - arr[i] % 10);
        arr[i] += (10 - arr[i] % 10);
      } else {
        k = 0;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    sum += 100 - arr[i];
    ans += arr[i] / 10;
  }
  ans += min(sum, k) / 10;
  cout << ans;
}
