#include <bits/stdc++.h>
using namespace std;
struct node {
  int v1, v2;
  bool operator<(const node& rhs) const { return v2 < rhs.v2; }
} a;
int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  priority_queue<node> q;
  for (int i = 0; i < n; i++) {
    int x, y;
    node e;
    scanf("%d", &x);
    y = x % 10;
    e.v1 = x, e.v2 = y;
    q.push(e);
  }
  int ans = 0;
  bool flag = false;
  while (k > 0 && (!q.empty())) {
    node e = q.top();
    q.pop();
    if (e.v1 < 100) {
      int ret = 10 - e.v2;
      if (k >= ret) {
        k -= ret;
        e.v1 += ret;
        e.v2 = 0;
        q.push(e);
      } else {
        flag = true;
        q.push(e);
      }
    } else
      ans += 10;
    if (flag) break;
  }
  while (!q.empty()) {
    node e = q.top();
    q.pop();
    ans += e.v1 / 10;
  }
  printf("%d\n", ans);
  return 0;
}
