Simple Solution in Java 
Code

# Code
```java []
class Solution {
    public ListNode modifiedList(int[] nums, ListNode head) {
        Set<Integer> set = new HashSet<>();
        for (int val : nums)
            set.add(val);
             
        ListNode newDummy = new ListNode(0, head);
        ListNode curr = newDummy;

        while (curr.next != null) {
            if (set.contains(curr.next.val))
                curr.next = curr.next.next;
            else 
                curr = curr.next;
        }
        return newDummy.next;
    }
}
```
['Array', 'Hash Table', 'Linked List', 'Java']